package com.dianping.cat.home.storage.transform;
import com.dianping.cat.home.storage.entity.Link;
import com.dianping.cat.home.storage.entity.Storage;
import com.dianping.cat.home.storage.entity.StorageGroup;
import com.dianping.cat.home.storage.entity.StorageGroupConfig;
import java.util.ArrayList;
import java.util.List;

public class DefaultLinker implements ILinker {
  private boolean m_deferrable;

  public DefaultLinker(boolean deferrable) {
/* 13 */     this.m_deferedJobs = new ArrayList();


/* 16 */     this.m_deferrable = deferrable;
  }
  private List<Runnable> m_deferedJobs;
  public void finish() {
/* 20 */     for (Runnable job : this.m_deferedJobs) {
/* 21 */       job.run();
    }
  }


  public boolean onLink(StorageGroup parent, Link link) {
/* 27 */     parent.setLink(link);
/* 28 */     return true;
  }


  public boolean onStorage(final StorageGroup parent, final Storage storage) {
/* 33 */     if (this.m_deferrable) {
/* 34 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 37 */               parent.addStorage(storage);
            }
          });
    } else {
/* 41 */       parent.addStorage(storage);
    }

/* 44 */     return true;
  }


  public boolean onStorageGroup(final StorageGroupConfig parent, final StorageGroup storageGroup) {
/* 49 */     if (this.m_deferrable) {
/* 50 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 53 */               parent.addStorageGroup(storageGroup);
            }
          });
    } else {
/* 57 */       parent.addStorageGroup(storageGroup);
    }

/* 60 */     return true;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/storage/transform/DefaultLinker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */